<?php

declare(strict_types=1);

namespace App\CustHub\Request;

use Mine\MineFormRequest;

class WxOauthRequest extends MineFormRequest
{

    /**
     * 扫码登录状态
     */
    public function checkQrLoginRules(): array
    {
        return [
            'login_id' => 'required',
        ];
    }

    public function checkUserRules(): array
    {
        return [
            'login_id' => 'required',
            'openid' => 'required',
        ];
    }

    public function bindMobileRules(): array
    {
        return [
            'login_id' => 'required',
            'openid' => 'required',
            'mobile' => 'required',
            'code' => 'required',
//            'password' => 'required|confirmed|min:6|max:20',
//            'password_confirmation' => 'required|min:6|max:20',
        ];
    }

    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'login_id' => '登录ID',
            'mobile' => '手机号',
        ];
    }

    /**
     * 获取已定义验证规则的错误消息。
     *
     * @return array
     */
    public function messages(): array
    {
        return [
            'password.required' => '密码必须输入',
            'password.confirmed' => '密码与再次输入密码需要一致',
            'password.min' => '密码最短不少于6个字符',
            'password.max' => '密码最长不多于二十个字符',
            'password_confirmation.required' => '密码必须再次输入',
            'password_confirmation.min' => '再次输入密码最短不少于6个字符',
            'password_confirmation.max' => '再次输入密码最长不多于二十个字符',
        ];
    }
}